<template>
  <div class="container">
    <div class="container programmer">
      <!-- 左侧导航 -->
      <div class="aside">
        <ul class="nav nav-pills nav-stacked">
          <li role="presentation">
            <router-link
              :class="{actived:navDataList[n].id === 1}"
              :to="{
                name: 'backend',
                query: {
                  type: 1,
                },
              }"
              >前端</router-link
            >
          </li>
          <li role="presentation">
            <router-link
              :class="{actived:navDataList[n].id === 2}"
              :to="{
                name: 'fontend',
                query: {
                  type: 2,
                },
              }"
              >后端</router-link
            >
          </li>
          <li role="presentation">
            <router-link
              :class="{actived:navDataList[n].id === 3}"
              :to="{
                name: 'andriod',
                query: {
                  type: 3,
                },
              }"
              >Android</router-link
            >
          </li>
          <li role="presentation">
            <router-link
              :class="{actived:navDataList[n].id === 4}"
              :to="{
                name: 'ios',
                query: {
                  type: 4,
                },
              }"
              >IOS</router-link
            >
          </li>
          <li role="presentation">
            <router-link
              :class="{actived:navDataList[n].id === 5}"
              :to="{
                name: 'intelligence',
                query: {
                  type: 5,
                },
              }"
              >人工智能</router-link
            >
          </li>
          <li role="presentation">
            <router-link
              :class="{actived:navDataList[n].id === 6}"
              :to="{
                name: 'database',
                query: {
                  type: 6,
                },
              }"
              >数据库</router-link
            >
          </li>
          <li role="presentation">
            <router-link
              :class="{actived:navDataList[n].id === 7}"
              :to="{
                name: 'program',
                query: {
                  type: 7,
                },
              }"
              >程序开发</router-link
            >
          </li>
        </ul>
      </div>
      <!-- 主体内容 -->
      <router-view />
    </div>
  </div>
</template>

<script>
import {mapState} from 'vuex'
export default {
  name: "ITTechnique",
  data() {
    return {
      n:0,
      flag:true
    };
  },
  mounted(){
    this.$store.dispatch('gitNavList')
  },
  computed:{
    ...mapState({
      navDataList:state => state.IT.navDataList || []
    })
  },
  watch:{
    //高亮监视路径
    $route(){
      if(this.$route.name === 'backend'){
        this.n = 0
      }else if(this.$route.name === 'fontend'){
        this.n = 1
      }else if(this.$route.name === 'andriod'){
        this.n = 2
      }else if(this.$route.name === 'ios'){
        this.n = 3
      }else if(this.$route.name === 'intelligence'){
        this.n = 4
      }else if(this.$route.name === 'database'){
        this.n = 5
      }else if(this.$route.name === 'program'){
        this.n = 6
      }
    }
  }
};
</script>

<style lang="less" scoped>
.container {
  width: 100%;
  .programmer {
    width: 960px;
    margin-right: auto;
    margin-left: auto;
    padding-left: 15px;
    padding-right: 15px;
    .aside {
      position: fixed;
      top: 0;
      bottom: 0;
      margin: 86px 0 0;
      padding: 0 0 30px;
      width: 280px;
      overflow: auto;
      .nav-pills {
        li {
          a {
            color: #333;
            font-weight: 500;
            &:hover {
              background-color: #f0f0f0;
              color: #ea6f5a !important;
            }
            &.actived {
            background-color: #f0f0f0;
            color: #ea6f5a !important;
          }
          }
        }
      }
    }
    .col-xs-offset-8 {
      margin-left: 33.33333%;
    }
    .col-xs-18 {
      width: 75%;
      float: left;
      .content-main {
        .note-list {
          margin-top: 0px;
          margin-bottom: 10px;
          list-style: none;
          .itemlist-box {
            position: relative;
            width: 100%;
            margin: 0 0 15px;
            padding: 15px 2px 20px 0;
            border-bottom: 1px solid #f0f0f0;
            word-wrap: break-word;
            box-sizing: border-box;
            .content {
              .title {
                color: #333;
                margin: -7px 0 4px;
                display: inherit;
                font-size: 18px;
                font-weight: 700;
                line-height: 1.5;
                &:hover {
                  text-decoration: none;
                }
              }
              .abstract {
                margin: 0 0 8px;
                font-size: 13px;
                line-height: 24px;
                color: #999;
              }
              .meta {
                font-size: 12px;
                font-weight: 400;
                line-height: 20px;
                .jsd-meta {
                  margin-right: 10px;
                  color: #ea6f5a;
                  i {
                    font-size: 12px;
                    font-weight: normal !important;
                  }
                }
                a {
                  margin-right: 10px;
                  color: #b4b4b4;
                  text-decoration: none;
                  i {
                    font-size: 12px;
                    font-weight: normal !important;
                  }
                }
                span {
                  margin-right: 10px;
                  color: #b4b4b4;
                  i {
                    font-size: 12px;
                    font-weight: normal !important;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
</style>
